<extend name="Public:common" />

<block name="main">
    <form action="{:U('Hooks/update')}" id="j_custom_form" url="{:U('Hooks/index')}" class="form-validate col-md-12" method="post" callback="TabAjaxDone" noEnter>
      <input type="hidden" name="id" value="{$info.id}" />
     
      <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>钩子名称：</label></div>
          <div class="form-input col-md-6">
            <input size="20" type="text" class="validate[required,custom[NoXhxOneLetter]] required" name="name" id="j_name" value="{$info.name}"  >
            <div class="font-yellow mrg10T">需要在程序中先添加钩子，否则无效</div>
           </div>
           </div>
          <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>钩子描述：</label></div>
          <div class="form-input col-md-6">
                             <textarea name="description" id="j_description" class="autosize validate[required] required" rows="4" cols="30">{$info.description}</textarea>
                 <div class="font-yellow mrg10T">区分钩子的主要用途</div>
           </div>
           </div>
           <div class="form-row">
	 <div class="form-label col-md-2 text-right">
	 <label>钩子挂载的插件排序：</label>
	 </div>
          <div class="form-input col-md-4">
                        <div id="zs_dragsort_placeholder" style="display: none;"><li class='draging-place'>&nbsp;</li></div>
                       
                             <input type="hidden" name="addons" value="{$info.addons}" readonly>
					<empty name="info.addons">
						暂无插件，无法排序
					<else />
					
					<ul id="sortUl" class="zs-dragsort"  data-selector="li.getSort" data-dragend="updateVal" data-placeholder="#zs_dragsort_placeholder">
						<volist name=":explode(',',$info['addons'])" id="addons_vo">
							<li class="getSort bg-azure medium"><b>&times;</b><em>{$addons_vo}</em></li>
						</volist>
					</ul>
					<script type="text/javascript">
						$(function(){
							$('#sortUl li b').click(function(){
                            	$(this).parent().remove();
                            	updateVal();
                            });
						});
							// 更新排序后的隐藏域的值
	                        function updateVal() {
	                        	var sortVal = [];
	                        	
                            	$('#sortUl li').each(function(){
                            		sortVal.push($('em',this).text());
                            	});
                                $("input[name='addons']").val(sortVal.join(','));
	                        }
						
					</script>
					</empty> 
					</div>
					</div>
                 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>钩子类型：</label></div>
          <div class="col-md-6">
                              <select name="type"  data-container="body"  id="j_type" class="selectpicker show-tick validate[required]" data-style="btn medium bg-green" data-width="auto">
                               
                                <volist name="type" id="zs">
                               <option <if condition="$info['type'] eq $key">selected</if> value="{$key}">{$zs}</option>
                               </volist>
                               
                              </select>
                      <div class="font-yellow mrg10T">拖动后保存顺序，影响同一个钩子挂载的插件执行先后顺序</div>
           </div>
           </div>
           
          
 
		<div class="actionBar">
		<div class="form-input mrg20B text-right">
           <button type="submit" class="btn medium bg-blue">保存</button>
           <button type="button" url="{:U('Hooks/index')}" class="btn-close btn medium bg-red mrg15L">取消</button>
       </div>    
		</div>
    </form>
</block>